from django.contrib import admin
from django.urls import path, include, re_path
from django.views.static import serve
from django.conf import settings
from drf_spectacular.views import SpectacularJSONAPIView, SpectacularRedocView, SpectacularSwaggerView


urlpatterns = [
    path('admin/', admin.site.urls),
    path('/', include('api.good.urls')),
    path('shops/', include('api.shop.urls')),
    path('carts/', include('api.cart.urls')),
    path('/', include('api.order.urls')),
    path('addresses/', include('api.address.urls')),
    re_path('media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}),
    path('swagger/json/', SpectacularJSONAPIView.as_view(), name='schema'),
    # swagger接口文档
    path('swagger/ui/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
    # redoc接口文档
    path('swagger/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'),
]